package com.thrift.distributed.process;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

/**
 * @包名称 com.thrift.distributed.process
 * @类描述 <pre></pre>
 * @作者 zhangbo
 * @创建时间 2019/9/20
 * @版本 1.00
 * @修改记录 <pre>
 *     版本           修改人         修改日期         修改内容描述
 *     -----------------------------------------------------------
 *     1.00           Lenovo        2019/9/20
 *     -----------------------------------------------------------
 * </pre>
 */
@Component
@Slf4j
@Order(value = 2)
public class ClientRun implements CommandLineRunner {

    @Autowired
    private ClientListener clientListener;

    /*注册中心超时或重复检测休眠时间(服务列表丢失找回)*/
    @Value("${ZOOKEEPER.SERVICE.SLEEP.TIME:10000}")
    private int zookeeperServiceSleepTime;

    @Override
    public void run(String... strings) throws Exception {
        log.info("开始启用客户端");
        new Thread(new RegistRunable(clientListener,zookeeperServiceSleepTime)).start();
        log.info("客户端启动完成");
    }
}
